from tkinter import *

root=Tk()

w=Canvas(root,width=600,height=200)
w.pack()

# line1=w.create_line(0,100,400,100,fill='red')
line2=w.create_line(200,0,200,200,fill='black',dash=(4,4))
rectangle1=w.create_rectangle(150,50,450,150,dash=(5,5))

w.create_oval(150,50,250,150,fill='blue')
#修改的三种方法
# w.coords(line1,25,100,425,100)
# w.itemconfig(rectangle1,fill='red')
# w.delete(line2)

Button(root,text="清空",command=(lambda x=ALL:w.delete(x))).pack()

mainloop()